#include <stdio.h>

int main ()
{
    int max = 1000;
    int sum = 0;
    int i;
 
    for (i=3; i<max; i+=3)
    {
        sum+=i;
    }
    for (i=5; i<max; i+=5)
    {
        sum+=i;
    }
    for (i=15; i<max; i+=15)
    {
        sum-=i;
    }
    printf("sum=%d", sum);
    return 0;
}